package com.tansun.easycare.rule.policytree.model;

import java.io.Serializable;

import com.tansun.easycare.rule.common.model.BaseItem;
import com.tansun.easycare.rule.common.model.BomField;

/**
 * 决策键
 */
public class PolicyTreeKey extends BaseItem implements Serializable, Comparable<PolicyTreeKey> {

    /**
     *
     */
    private static final long serialVersionUID = -6503495625082232398L;

    /**
     * id
     */
    private String id;
    /**
     * 决策键名称
     */
    private String name;

    /**
     * 决策键值
     */
    private String value;
    /**
     * 层数
     */
    private Integer floor;


    public PolicyTreeKey() {
        super();
    }

    public PolicyTreeKey(String id, String name, String value, Integer floor) {
        super();
        this.id = id;
        this.name = name;
        this.value = value;
        this.floor = floor;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getFloor() {
        return floor;
    }

    public void setFloor(Integer floor) {
        this.floor = floor;
    }

    @Override
    public int compareTo(PolicyTreeKey o) {
        return this.getFloor().compareTo(o.getFloor());
    }

    public void initKeyModel(BomField param) {
        this.setClassName(param.getClassName());
        this.setCollection(param.getCollection());
        this.setDataType(param.getDataType());
        this.setDefaultValue(param.getDefaultValue());
        this.setDomain(param.getDomain());
        this.setIsDerives(param.getIsDerives());
    }

}
